package com.three.menumanagement.service.impl;

import com.three.core.entity.Menu;
import com.three.menumanagement.mapper.MenuMapper;
import com.three.menumanagement.service.MenuService;
import com.three.core.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    private MenuMapper menuMapper;
    @Override
    public R addMenu(Menu menu) {
        int insert = menuMapper.insert(menu);
        if (insert > 0){
            return new R(200,"添加成功",null);
        }else {
            return new R(500,"添加失败",null);
        }
    }

    @Override
    public R updateMenu(Menu menu) {
        int i = menuMapper.updateById(menu);
        if (i > 0){
            return new R(200,"修改成功",null);
        }else {
            return new R(500,"修改失败",null);
        }
    }
}
